package com.wc.算法提高课.E第五章_数学知识.组合计数.序列统计;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/7 16:28
 * @description https://www.acwing.com/problem/content/1314/
 */
public class Main {
    /**
     * 思路：<p>
     * 从 m = R - L + 1, 中选出 k (1 <= k <= N) 个数保证 L <= a[1] <= a[2] <= a[3] <= ... <= a[k] <= R<p>
     * 设 b[1] = a[i] - L<p>
     * 0 <= b[1] <= b[2] <= b[3] <= b[4] + ... <= b[k] <= R - L<p>
     * c[i] = b[i] - b[i - 1](b[0] = 0), c[i] >= 0
     * c[1] + c[2] + ... + c[k] <= R - L<p>
     * d[i] = c[i] + 1 >= 1 <p>
     * d[1] + d[2] + d[3] + ... + d[k] <= R - L + k<p>
     * 不等式的隔板法：C(R - L + k, k), 表示最后一个数是可以 >= 0的, 所以在最后一个数的后面加一块板子来抵消下界<p>
     * 已知 C(n, m) = C(n - 1, m) + C(n - 1, m - 1), C(n, m) = C(n, n - m)<p>
     * 答案res<p>
     * = C(R - L + 1, 1) + C(R - L + 2, 2) + ... + C(R - L + N, N)<p>
     * = C(R - L + 1, R - L) + C(R - L + 2, R - L) + ... + C(R - L + N, R - L)<p>
     * = C(R - L + 1, R - L + 1) + C(R - L + 1, R - L) + C(R - L + 2, R - L) + ... + C(R - L + N, R - L) - C(R - L + 1, R - L + 1)<p>
     * = C(R - L + 2, R - L + 1) + C(R - L + 2, R - L) +  + ... + C(R - L + N, R - L) - 1<p>
     * = C(R - L + N + 1, R - L + 1) - 1<p>
     * 因为R - L + N + 1的范围比较大, 用Lucas定理求得 <p>
     * C(a,b) == C(a % p, b % p) * C(a / p, b / p) (mod p)
     *
     * @see com.wc.算法基础课.D第四讲数学知识.求组合数.求组合数_III;
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 1000010, P = (int) 1e6 + 3;
    static long[] fact = new long[N], infact = new long[N];

    public static void main(String[] args) {
        int T = sc.nextInt();
        fact[0] = infact[0] = 1;
        for (int i = 1; i < N; i++) {
            fact[i] = fact[i - 1] * i % P;
            infact[i] = qmi(fact[i], P - 2);
        }
        while (T-- > 0) {
            int n = sc.nextInt(), l = sc.nextInt(), r = sc.nextInt();
            out.println((Lucas(r - l + n + 1, r - l + 1) + P - 1) % P);
        }
        out.flush();
    }

    static long Lucas(int n, int m) {
        if (n < P && m < P) return C(n, m);
        return Lucas(n / P, m / P) * C(n % P, m % P) % P;
    }

    static long C(int n, int m) {
        if (n < m) return 0;
        return fact[n] * infact[m] % P * infact[n - m] % P;
    }

    static long qmi(long a, int k) {
        long res = 1;
        while (k > 0) {
            if ((k & 1) == 1) res = res * a % P;
            a = a * a % P;
            k >>= 1;
        }
        return res;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
